<template>
  <div>
    <div v-if="wechatAuth">授权成功</div>
    <div v-else>授权失败</div>
    <el-button type="primary" @click="$router.push({name: 'WechatList'})">返回列表页</el-button>
  </div>
</template>
<script>
  import {mapState, mapActions} from 'vuex'
  export default {
    mounted () {
      this.validateWechatAuth({
        authCode: this.$route.query['auth_code'],
        expire: this.$route.query['expires_in']
      })
    },
    computed: {
      ...mapState({
        wechatAuth: state => state.wechatManage.wechatAuth
      })
    },
    methods: {
      ...mapActions(['validateWechatAuth'])
    }
  }
</script>
